'\" te
.\"  Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH MT 1 "Jun 21, 2007"
.SH NAME
mt \- magnetic tape control
.SH SYNOPSIS
.LP
.nf
\fBmt\fR [\fB-f\fR \fItapename\fR] \fIcommand\fR... [\fIcount\fR]
.fi

.SH DESCRIPTION
.LP
The \fBmt\fR utility sends commands to a magnetic tape drive. If \fB-f\fR
\fItapename\fR is not specified, the environment variable \fBTAPE\fR is used.
If \fBTAPE\fR does not exist, \fBmt\fR uses the device \fB/dev/rmt/0n\fR.
.SH OPTIONS
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-f\fR \fItapename\fR\fR
.ad
.RS 15n
Specifies the raw tape device.
.RE

.SH OPERANDS
.LP
The following operands are supported:
.sp
.ne 2
.na
\fB\fIcount\fR\fR
.ad
.RS 11n
The number of times that the requested operation is to be performed. By
default, \fBmt\fR performs \fIcommand\fR once. Multiple operations of
\fIcommand\fR can be performed by specifying \fIcount\fR.
.RE

.sp
.ne 2
.na
\fB\fIcommand\fR\fR
.ad
.RS 11n
The following available commands that can be sent to a magnetic tape drive are
supported. Only as many characters as are required to uniquely identify a
\fIcommand\fR need be specified.
.sp
.ne 2
.na
\fB\fBasf\fR\fR
.ad
.RS 10n
Specifies absolute space to \fIcount\fR file number. This is equivalent to a
\fBrewind\fR followed by a \fBfsf\fR \fIcount\fR.
.RE

.sp
.ne 2
.na
\fB\fBbsf\fR\fR
.ad
.RS 10n
Back spaces over \fIcount\fR EOF marks. The tape is positioned on the
beginning-of-tape side of the EOF mark.
.RE

.sp
.ne 2
.na
\fB\fBbsr\fR\fR
.ad
.RS 10n
Back spaces \fIcount\fR records.
.RE

.sp
.ne 2
.na
\fB\fBbssf\fR\fR
.ad
.RS 10n
Back spaces over the requested number of sequential file marks. Sequential file
marks are where the file marks are one right after the other with no other
blocks of any kind between the file marks. The number argument specifies how
many sequential file marks to which to space. For example, \fBbssf 4\fR
searches backwards to the first place where there are 4 sequential file marks
and positions to the BOP side of the 4th file mark.
.sp
This command is not supported by all drives.
.RE

.sp
.ne 2
.na
\fB\fBeof\fR\fR
.ad
.br
.na
\fB\fBweof\fR\fR
.ad
.RS 10n
Writes \fIcount\fR EOF marks at the current position on the tape.
.RE

.sp
.ne 2
.na
\fB\fBfsf\fR\fR
.ad
.RS 10n
Forward spaces over \fIcount\fR EOF marks. The tape is positioned on the first
block of the file.
.RE

.sp
.ne 2
.na
\fB\fBfsr\fR\fR
.ad
.RS 10n
Forward spaces \fIcount\fR records.
.RE

.sp
.ne 2
.na
\fB\fBfssf\fR\fR
.ad
.RS 10n
Forward spaces the over requested number of sequential file marks. Sequential
file marks are where the file marks are one right after the other with no other
blocks of any kind between the file marks. The number argument specifies how
many sequential file marks to which to space. For example, \fBfssf 4\fR
searches forwards to the first place where there are 4 sequential file marks
and positions after the 4th file mark.
.sp
This command is not supported by all drives.
.RE

.sp
.ne 2
.na
\fB\fBload\fR\fR
.ad
.RS 10n
Requests drive load and thread current media. Not supported by all drives.
.RE

.sp
.ne 2
.na
\fB\fBlock\fR\fR
.ad
.RS 10n
Prevents media removal.
.RE

.sp
.ne 2
.na
\fB\fBnbsf\fR\fR
.ad
.RS 10n
Back spaces \fIcount\fR files. The tape is positioned on the first block of the
file. This is equivalent to \fIcount+1\fR \fBbsf\fRs followed by one \fBfsf\fR.
.RE

.sp
.ne 2
.na
\fB\fBseek\fR\fR
.ad
.RS 10n
Positions to requested logical tape position.
.RE

.sp
.ne 2
.na
\fB\fBtell\fR\fR
.ad
.RS 10n
Gets and prints current logical tape position.
.RE

.sp
.ne 2
.na
\fB\fBunlock\fR\fR
.ad
.RS 10n
Allows media removal.
.RE

If \fIcount\fR is specified with any of the following commands, the \fIcount\fR
is ignored and the command is performed only once.
.sp
.ne 2
.na
\fB\fBconfig\fR\fR
.ad
.RS 16n
Reads the drives current configuration from the driver and displays it in
\fBst.conf\fR format. See \fBst\fR(4D) for definition of fields and there
meanings.
.RE

.sp
.ne 2
.na
\fB\fBeom\fR\fR
.ad
.RS 16n
Spaces to the end of recorded media on the tape. This is useful for appending
files onto previously written tapes.
.RE

.sp
.ne 2
.na
\fB\fBerase\fR\fR
.ad
.RS 16n
Erases the entire tape.
.sp
Some tape drives have option settings where only portions of the tape can be
erased. Be sure to select the correct setting to erase the whole tape. Erasing
a tape can take a long time depending on the device and/or tape. Refer to the
device specific manual for time details.
.RE

.sp
.ne 2
.na
\fB\fBforcereserve\fR\fR
.ad
.RS 16n
Attempts to break a SCSI II reserve issued by another initiator. When this
command completes, the drive is not reserved for the current initiator, but is
available for use. This command can be only be executed by those with
super-user privileges.
.RE

.sp
.ne 2
.na
\fB\fBoffline\fR\fR
.ad
.br
.na
\fB\fBrewoffl\fR\fR
.ad
.RS 16n
Rewinds the tape and, if appropriate, takes the drive unit off-line by
unloading the tape.
.RE

.sp
.ne 2
.na
\fB\fBrelease\fR\fR
.ad
.RS 16n
Re-establishes the default behavior of releasing at close.
.RE

.sp
.ne 2
.na
\fB\fBreserve\fR\fR
.ad
.RS 16n
Allows the tape drive to remain reserved after closing the device. The drive
must then be explicitly released.
.RE

.sp
.ne 2
.na
\fB\fBretension\fR\fR
.ad
.RS 16n
Rewinds the cartridge tape completely, then winds it forward to the end of the
reel and back to beginning-of-tape to smooth out tape tension.
.RE

.sp
.ne 2
.na
\fB\fBrewind\fR\fR
.ad
.RS 16n
Rewinds the tape.
.RE

.sp
.ne 2
.na
\fB\fBstatus\fR\fR
.ad
.RS 16n
Prints status information about the tape unit.
.sp
Status information can include the sense key reported by the drive, the
residual and retries for the last operation, the current tape position reported
in file number, and the number of blocks from the beginning of that file. It
might also report that WORM media is loaded in that drive.
.RE

.RE

.SH EXIT STATUS
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 5n
All operations were successful.
.RE

.sp
.ne 2
.na
\fB\fB1\fR\fR
.ad
.RS 5n
Command was unrecognized or \fBmt\fR was unable to open the specified tape
drive.
.RE

.sp
.ne 2
.na
\fB\fB2\fR\fR
.ad
.RS 5n
An operation failed.
.RE

.SH FILES
.ne 2
.na
\fB\fB/dev/rmt/*\fR\fR
.ad
.RS 14n
magnetic tape interface
.RE

.SH SEE ALSO
.LP
.BR tar (1),
.BR tcopy (1),
.BR ar.h (3HEAD),
.BR st (4D),
.BR mtio (4I),
.BR attributes (7)
.SH BUGS
.LP
Not all devices support all options. Some options are hardware-dependent. Refer
to the corresponding device manual page.
.sp
.LP
\fBmt\fR is architecture sensitive. Heterogeneous operation (that is, SPARC to
x86 or the reverse) is not supported.
